function Stopwatch() {}

Stopwatch.prototype = {
    startTime: 0,
    running: false,
    elapsed: undefined,
    start() {
        this.startTime = +new Date();
        this.elapsedTIme = undefined;
        this.running = true;
    },
    stop() {
        this.elpsed = +new Date() - this.startTime;
        this.running = false;
    },
    getElapsedTime() {
        if (this.running) {
            return +new Date() - this.startTime;
        } else {
            return this.elapsed;
        }
    },
    isRunning() {
        return this.running;
    },
    reset() {
        this.elapsed = 0;
    }
};
